import request from '@/utils/request'

export const checkOrder = (mode, cartIds, cartId,number) => {
  return request.post('/order/generator', {
      mode,
      cartIds,
      cartId,
      number
  })
}

// 提交订单
export const submitOrderAndUpdate = (orderId,deliveryId,couponId,payType,recipient,phone,address,remark) => {
  return request.post('/pay/submit', {orderId,deliveryId,couponId,payType,recipient,phone,address,remark})
}

// 订单列表
export const getMyOrderList = (dataType) => {
  return request.get('/order/list', {
    params: {
      dataType
    }
  })
}
// 获取单个订单
export const getMyOrderOne = (orderId) => {
  return request.get(`/order/one/${orderId}` )
}

// 修改订单状态
export const updateOrderStatus = (status,orderId) => {
  return request.put(`/order/update/${status}/${orderId}` )
}

// 删除订单
export const cancelRefund = (orderId) => {
  return request.put(`/order/cancel/${orderId}` )
}